const mongoose = require("mongoose");

function resFormatPlugin(schema, options) {
  schema.set("toObject", {
    transform: function (doc, ret, options) {
      ret.id = ret._id.toString();
      delete ret.__v;
      delete ret._id;
    },
  });
}

mongoose.plugin(resFormatPlugin);
